
function cko_update()
  local t = GetTime()
  if t>cko_gps_last_updated + 1 then
    SetMapToCurrentZone()
    local x,y=GetPlayerMapPosition("player")
    if cko_precision > 0 then
      CKOText:SetText(format("%s (%2.1f,%2.1f)",GetZoneText(),
        100*x+0.5,100*y+0.5))
    else
      CKOText:SetText(format("%s (%d,%d)",GetZoneText(),100*x+0.5,100*y+0.5))
    end
    cko_gps_last_updated = t
    cko_xp_new = UnitXP("player")
    if cko_xp_last ~= cko_xp_new then
      cnew = cko_cumulative_kills();
      if cko_cumulative_last==0 then
        cko_print(format("%d kills to next level",
          cko_kills_to_next_level()))
      else
        cko_print(format("%d kills to next level (last kill was worth +%3f)",
          cko_kills_to_next_level(),cnew-cko_cumulative_last))
      end
      cko_cumulative_last = cnew;
      cko_xp_last=cko_xp_new;
      if cko_last_kill_time>0 then
        cko_print(format('time since last kill: %d',time()-cko_last_kill_time))
      end
      cko_last_kill_time=time()
    end
  end
end

